import java.util.*;
public class ArrQueue {
    List<Object> data;
    private Object[] array=new Object[data.size()];
    private int tail = 0;
    public Object element (){
        if(array.length==0)
            throw new NoSuchElementException();
        return array[0];
    }
    public Object peek (){
        if(array.length==0){
            return null;
        }else{
        return array[0];
        }
    }
    boolean offer(Object element ) throws ClassCastException, NullPointerException,IllegalArgumentException {
        if (tail==array.length){
            return false;
        }else{
        array[tail] = element;
        tail++;
        return true;
        }
    }
    public Object poll(){
        if(tail==0){
        return null;
        } else{
            Object first=array[0];
            tail--;
            for (int i=0; i < tail; i++)
                array[i] = array[i+1];
            array[tail] = null;
            return first;
        }
    }
    public Object remove(){
        if(tail==0)
           throw new NoSuchElementException();
            Object first=array[0];
            tail--;
            for (int i=0; i < tail; i++)
                array[i] = array[i+1];
            array[tail] = null;
            return first;
    }
}


